# Standart methods in Invidious class

## __init__
Init class method. 

```
Arguments:
    isLoggerEnabled: print some errors or not.
    timeout: requests timeout.
    mirrors: your own invidious mirrors list.
```

## update_mirrors
Check and updating invidious working mirrors list.

## get_working_mirror
Return first working invidious mirror.

## request
Just send request to get_working_mirror+query and return response in json.

## search
Invidious search method. Return list with VideoItem, ChannelItem, PlaylistItem.

```
Arguments:
    query: your search query.
    page: number of page.
    sort_by: [relevance, rating, upload_date, view_count].
    date: [hour, today, week, month, year].
    duration: [short, long].
    ctype: [video, playlist, channel, all] (default: video).
    feauters: [hd, subtitles, creative_commons, 3d, live, purchased, 4k, 360, location, hdr].
    region: ISO 3166 country code (default: US).
```

Example:
```py
from invidious import *

iv = Invidious()
searched = iv.search("distrotube")

for item in searched:
    if type(item) == ChannelItem:
        print(item.author) 
        # Print names of all channels
        # in first page of result 'distrotube'
```

## get_video
Invidious get_video method. Return Video by id.

```
Arguments:    
    videoId: id of video.
    region: ISO 3166 country code (default: US).
```

Example:
```py
from invidious import *

iv = Invidious()
searched = iv.search("distrotube")

videos = []

for item in searched:
    if type(item) == VideoItem:
        video = iv.get_video(item.videoId)
        # Get video via VideoItem id.
        # Video class need, because he has many options than VideoItem
        videos.append(video)

for video in videos:
    print(video.title, video.likeCount)
    # Print video title and video like count
```

## get_channel
Invidious get_channel method. Return Channel by id.
    
```
Arguments:
    authorId: id of channel.
    sort_by: sorting channel videos. [newest, oldest, popular] (default: newest).
```

Example:
```py
from invidious import *

iv = Invidious()
searched = iv.search("distrotube")

channels = []

for item in searched:
    if type(item) == ChannelItem:
        channel = iv.get_channel(item.authorId)
        # Get channel via ChannelItem authorId.
        # Channel class need, because he has many options than ChannelItem
        channels.append(channel)

for channel in channels:
    print(channel.author, channel.totalViews)
    # Print channel author name and channel total views
```

## get_popular
Invidious get_popular method. Return list with ShortVideo.
    
Example:
```py
from invidious import *

iv = Invidious()
popular = iv.get_popular()

for video in popular:
    print(video.title)
    # Print video title
```

## get_trending
Invidious get_trending method. Return list with VideoItem.

```
Arguments:
    type: [Music, Gaming, News, Movies].
    region: ISO 3166 country code (default: US).
```

Example:
```py
from invidious import *

iv = Invidious()
trending = iv.get_trending(type="Music")

for video in trending:
    print(video.title)
    # Print video title
```

## get_comments
Invidious get_comments method. Return CommentsList by videoId

```
Arguments:
    sort_by: "top", "new" (default: top)
    source: "youtube", "reddit" (default: youtube)
    continuation: like next page of comments
```

Example:
```py
from invidious import *

iv = Invidious()
searched = iv.search("distrotube")

video = None
for item in searched:
    if type(item) == VideoItem:
        video = iv.get_video(item.videoId)
        # Get video via VideoItem id.
        # Video class need, because he has many options than VideoItem
        break

clist = iv.get_comments(video.videoId)
comments = clist.comments
for comment in comments:
    print(comment.content)
    # Print comment text
```